<template>
  <div class="more-action">
    <!-- 状态一 -->
    <van-cell-group v-if="!isReport">
      <!-- 点击不感兴趣 向父组件抛出事件 -->
      <van-cell @click="$emit('un-like')">不感兴趣</van-cell>
      <van-cell
        is-link
        @click="isReport=true"
      >反馈垃圾内容</van-cell>
      <van-cell>拉黑作者</van-cell>
    </van-cell-group>
    <!-- 状态二 反馈-->
    <van-cell-group v-else>
      <van-cell
        icon="arrow-left"
        @click="isReport=false"
      >返回</van-cell>
      <!-- @click="$emit('report', report.value)" -->
      <!-- 向父组件抛出事件，传递举报的具体类型（数值）-->
      <van-cell
        v-for="report in reports"
        :key="report.value"
        @click="$emit('report', report.value)"
      >
        {{report.label}}
      </van-cell>
    </van-cell-group>
  </div>
</template>

<script>
// 引用提前定义好的常量数据
import reports from '@/constant/reports.js'
export default {
  name: 'MoreAction',
  data () {
    return {
      isReport: false // 是否是处于状态二：反馈
    }
  },
  computed: {
    //  反馈的常量数据
    reports () {
      return reports
    }
  }
}
</script>

<style lang='less' scoped>
.more-action {
  border-radius: 4px;
}
</style>
